#include<windows.h>
#include<stdio.h>

static INT CALLBACK print_fullname_proc(const LOGFONTW *lf, const TEXTMETRICW
*ntm, DWORD type, LPARAM pParam)
{
    const ENUMLOGFONTW *elf = (const ENUMLOGFONTW *)lf;
    const WCHAR *fullname = (const WCHAR *)pParam;
    DWORD StrLen;
    char buffer[256];

    StrLen = WideCharToMultiByte(CP_ACP, 0, elf->elfFullName, -1, NULL, 0, NULL, FALSE);
    WideCharToMultiByte(CP_ACP, 0, elf->elfFullName, -1, buffer, StrLen, NULL, FALSE);
    printf("elf->elfFullName: %s\n", buffer);


    memset(buffer, 0, 256);
    StrLen = WideCharToMultiByte(CP_ACP, 0, elf->elfLogFont.lfFaceName, -1, NULL, 0, NULL, FALSE);
    WideCharToMultiByte(CP_ACP, 0, elf->elfLogFont.lfFaceName, -1, buffer, StrLen, NULL, FALSE);
    printf("elf->elfLogFont.lfFaceName : %s\n", buffer);

    return 1;
}

int main(void)
{
    HDC hdc = GetDC(0);
    BOOL ret = FALSE;
    LOGFONTW lf;
    int i;
#define font_count 7
#define wstr_len 64
    WCHAR fontname[font_count][wstr_len] = {{'S','i','m','S','u','n',0},
                            {'T','a','h','o','m','a',0},
                            {'L','u','c','i','d','a',' ','S','a','n','s',0},
                            {'A','r','i','a','l',0},
                            {'M','i','n','g','L','i','U',0},
                            {0x5b8b, 0x4f53, 0},
                            {'r','a','n','d','o','m',0}};

    memset(&lf, 0, sizeof(lf));
    lf.lfCharSet = 1;
    lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
    lf.lfHeight = 16;
    lf.lfWidth = 16;
    lf.lfQuality = DEFAULT_QUALITY;
    lf.lfItalic = FALSE;
    lf.lfWeight = FW_DONTCARE;

    for (i=0; i<font_count; i++)
    {
        printf("EnumFontFamilesW %S ... \n", fontname[i]);
        ret = EnumFontFamiliesW(hdc, fontname[i], print_fullname_proc, 0);
        printf("i = %d, ret = %d\n\n", i, ret);
    }

    return ret;
}
